4 of 14
As far as www2 is concerned, I never logged in. Most likely, your
application will deal with me just like any other user who's trying
to load a page that requires a login: it'll redirect me to a login
screen instead of showing me the page. But as a user who already
logged in when I was on www1, I won't be at all pleased. To put it
mildly, this isn't good. Leave such a problem unresolved and your
users will probably want to know where you live!
You might ask, "So what's the big deal?" Why not just use
session-sensitive load balancing and keep the user on a particular
server, with all their session variables stored in that server's
memory for the length of their session? Wouldn't that be easiest?
Here's where I stand by the term true load balancing and can show
it to be a better configuration. Session-sensitive load balancing
has one very real pitfall that occurs when a user has been
load-balanced to a particular server and has established a session
there, but that server then becomes unavailable. Should that happen,
the user will inevitably be shifted to another server in the
cluster, with the added hassle of losing their session variables in
the process. You'll need to change your application code to resolve
this problem, so why not use the more robust (true) load-balancing
solution as well?
As you may have guessed by now, I'm no advocate of
session-sensitive load balancing. I think of it this way: the
expense of hardware, software and configuration of a server cluster
can be justified only by gains in performance and failover
protection; session-sensitive load balancing can potentially be an
obstacle to both of those goals, while true load balancing actively
involves all of the servers in your cluster on a continuing basis,
fully achieving both of those goals. Most important, use of
session-sensitive load balancing inappropriately encourages the use
of session variables, which will quickly detract from the
user-transparent failover abilities of the clustering solution.
The bottom line? With either method of load balancing, use of
session variables is unacceptable. In reality, it doesn't matter
which load-balancing solution you choose - as long as you don't use
session variables, either one will work. However, it's my belief
that if you really want to gain the full benefits of server
clustering, you'll want to compose your ColdFusion application to
support true load-balancing, while still being able to maintain
client state. That's what this article is about.
4 of 14